package proxy.dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class SellWineTest {

    public static void main(String[] args) {

        MaotaiJiu maotaiJiu = new MaotaiJiu();
        Wuliangye wu = new Wuliangye();
        Furongwang fu = new Furongwang();

        InvocationHandler riemann = new GuitaiA(maotaiJiu,"茅台");
        InvocationHandler riemann2 = new GuitaiA(wu,"五粮液");
        InvocationHandler riemann3 = new GuitaiA(fu, "芙蓉王");

        SellWine dynamicProxy = (SellWine) Proxy.newProxyInstance(MaotaiJiu.class.getClassLoader(),
                MaotaiJiu.class.getInterfaces(), riemann);

        SellWine dynamicProxy2 = (SellWine) Proxy.newProxyInstance(Wuliangye.class.getClassLoader(),
                Wuliangye.class.getInterfaces(),riemann2);

        SellCigarette dynamicProxy3 = (SellCigarette) Proxy.newProxyInstance(Furongwang.class.getClassLoader(),
                Furongwang.class.getInterfaces(), riemann3);

        dynamicProxy.mainJiu();
        dynamicProxy2.mainJiu();
        dynamicProxy3.sell();

    }

    
}
